const ReactRefreshPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const path = require('path');
const webpack = require('webpack');

module.exports = merge(common, {
  mode: 'development',
  devtool: 'inline-source-map',
  devServer: {
    contentBase: path.join(__dirname, 'dist'),
    compress: true,
    port: 8081,
    historyApiFallback: true,
    //自动打开浏览器
    open: false,
    // inline: true,
    // hotOnly:true,
    hot: true, // 热更新
  },
  plugins: [
    new ReactRefreshPlugin(), // 为热更新插件  npm install -D @pmmmwh/react-refresh-webpack-plugin react-refresh
  ],
});
